package com.control.qct.businesssteward.activity;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.control.qct.businesssteward.R;
import com.control.qct.businesssteward.base.BaseActivity;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/1/27 0027.
 */

public class ChargebackStatusActivity extends BaseActivity {
    @BindView(R.id.iv_submit_status)
    ImageView mIvSubmitStatus;
    @BindView(R.id.tv_submit_status)
    TextView mTvSubmitStatus;
    @BindView(R.id.tv_chargeback_price)
    TextView mTvChargebackPrice;
    @BindView(R.id.tv_again_chargeback)
    TextView mTvAgainChargeback;
    @BindView(R.id.tv_complete_or_return)
    TextView mTvCompleteOrReturn;
    @BindView(R.id.ll_chargeback_price)
    LinearLayout mLlChargebackPrice;

    private int mId;

    public ChargebackStatusActivity() {
        super(R.layout.activity_chargeback_status);
    }

    @Override
    protected void getBundleExtras(Bundle extras) {
        super.getBundleExtras(extras);
        mId = extras.getInt("id");
    }

    @Override
    protected void initView() {
        setLeftIcon(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        setTitle("退单");
        mTvSubmitStatus.setTextColor(mId == 0 ? Color.parseColor("#05C1AB") : Color.parseColor("#FE4C6D"));
        mTvSubmitStatus.setText(mId == 0 ? "退单成功" : "退单失败");
        mLlChargebackPrice.setVisibility(mId == 0 ? View.VISIBLE : View.GONE);
        mTvAgainChargeback.setVisibility(mId == 0 ? View.GONE : View.VISIBLE);
        mTvCompleteOrReturn.setText(mId == 0 ? "完成" : "返回");
        mTvCompleteOrReturn.setTextColor(mId == 0 ? Color.parseColor("#FFFFFF") : Color.parseColor("#949494"));
        mTvCompleteOrReturn.setBackground(mId == 0 ? ContextCompat.getDrawable(this, R.drawable.shape_green_5) :
                ContextCompat.getDrawable(this, R.drawable.shape_grey_5));
    }


    @OnClick({R.id.tv_again_chargeback, R.id.tv_complete_or_return})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_again_chargeback:
                showShortToast("重新退款");
                break;
            case R.id.tv_complete_or_return:
                showShortToast(mId == 0 ? "完成" : "返回");
                break;
        }
    }
}
